package com.triones.api.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.triones.api.entity.GuideDO;
import com.triones.api.entity.vo.GuideVO;
import com.triones.api.mapper.GuideMapper;
import com.triones.api.service.AppManageService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * app管理 -业务实现
 */
@Service
@RequiredArgsConstructor
public class AppManageServiceImpl implements AppManageService {

    private final GuideMapper guideMapper;
    @Override
    public boolean addGuide(GuideDO dto) {
        return guideMapper.insert(dto) > 0;
    }

    @Override
    public boolean editGuide(GuideDO dto) {
        return guideMapper.updateById(dto) > 0;
    }

    @Override
    public GuideVO getGuideInfo() {
        LambdaQueryWrapper<GuideDO> lqw = Wrappers.lambdaQuery();
        lqw.last("limit 1");
        return guideMapper.selectVoOne(lqw);
    }
}
